import datetime, unittest

from .. import cron

class Test(unittest.TestCase):
    
    def test_basic(self):
        s = cron.Schedule(
            [2011, 2013, 2015],              # odd years
            [m for m in range(1,13) if m % 2], # odd months
            [d for d in range(1,32) if d % 2], # odd days
            [h for h in range(24) if h % 2], # odd hours
            [m for m in range(60) if m % 2]) # odd minutes
        n = cron.next(s, datetime.datetime(2012, 3, 15, 4, 34))
        self.assertEqual(n, datetime.datetime(2013, 1, 1, 1, 1))

    # def test_

def suite():
    return unittest.TestLoader().loadTestsFromTestCase(Test)

def main():
    unittest.TextTestRunner(verbosity=1).run(suite())

if __name__ == '__main__':
    main()
